package com.summer.demo.shiro.restcontroller;

import com.summer.demo.shiro.service.IRedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yanglei0504
 * @date 18-9-29 下午11:57
 **/
@RestController
@RequestMapping(value = "/test")
public class TestController {


    @Autowired
    private IRedisService redisService;

    @RequestMapping("/write2redis")
    public String query(String k, String v) {
        // 保存字符串
        redisService.put(k, v);
        return "key:" + k + " val:" + v;

    }


    @RequestMapping("/get/{key}")
    public String readAll(@PathVariable String key) {
        return redisService.get(key);

    }

    @RequestMapping("/readAll")
    public String readAll() {
        return null;

    }
}
